<template>
  <div>
    <!-- 头部导航 -->
    <w-bread-nav title="支付中心"></w-bread-nav>
    <div class="paySuccess app-container">
      <div class="payIcon">
        <div class="payBg"></div>
        <div class="tip">支付成功！</div>
      </div>
      
      <div class="btn-groups">
        <w-button class="btn" @on-click="$router.push(`my/order`)">查看订单</w-button>
        <!-- 倒计时 -->
        <div class="cut-down">
          <span class="c-main">{{time}}s</span>自动跳转至首页
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      timer: null,
      time: 10
    }
  },
  mounted() {
    clearInterval(this.timer)
    this.timer = setInterval(() => {
      this.time--
      if (this.time == 0) {
        clearInterval(this.timer)
        this.$router.push('/')
      }
    }, 1000)
  },
  destroyed() {
    clearInterval(this.timer)
  }
}
</script>

<style lang="scss" scoped>
  @import '../scss/_var.scss';
  .paySuccess {
    height: 435px;
    margin-top: 20px;
    background-color: $color-white;
  }
  .payIcon {
    width: 346px;
    margin: 0 auto;
    padding-top: 100px;
    padding-bottom: 30px;
    .payBg {
      width: 96px;
      height: 96px;
      background-image: url('../assets/payment/chenggong.png');
      background-repeat: no-repeat;
      background-size: contain;
      margin: auto;
      display: inline-block;
    }
  }
  .tip {
    display: inline-block;
    font-size: 46px;
    text-align: center;
    color: #333;
    // padding-bottom: 40px;
    height: 96px;
    line-height: 96px;
    vertical-align: top;
  }
  .btn-groups {
    margin: 76px auto 0;
    text-align: center;
    .btn {
      border: 1px solid $border-gray;
      color: $color-white;
      width: 206px;
      height: 63px;
      font-size: 24px;
      margin: 0 15px;
      border-radius: 45px;
      background-color: $color-main;
    }
    .cut-down {
      margin-top: 16px;
      font-size: 16px;
      color: $color-gray;
    }
  }
</style>
